<!--表单验证-->
<script type="text/javascript" src="__PUBLIC__/Js/jquery.validator.reg.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/jquery.corners.min.js"></script>
<link href="__PUBLIC__/Js/form_check/type.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/Css/reglogin.css" rel="stylesheet" type="text/css" />
<script>
$(function(){
	$('#loginForm').checkForm();
	$('#regform').checkForm();
	//doQuickLogin();
});
function ql_changeverify(){
    var date = new Date();
    var ttime = date.getTime();
    var url = "{:U('Index://Public/verify')}";
    $("#login_verify").attr('src',url+"/"+ttime);
    $("#regist_verify").attr('src',url+"/"+ttime);
}
function canDoFormSubmit(formid){
	var form=$('#'+formid);
	var elements = form.find(':input[require]');
	elements.blur(function(index){
		return validator.check(jQuery(this));
	});
	var isValid = true;
	var errIndex= new Array();
	var n=0;
	elements.each(function(i){
		if(validator.check(jQuery(this))==false){
			isValid  = false;
			errIndex[n++]=i;
		};
	});

	if(isValid==false){
		elements.eq(errIndex[0]).focus().select();
		return false;
	}

	return true;
}


function doFormLoginSubmit(formid){
	var result = canDoFormSubmit(formid);
	
	if(result){
		$('#show_logining').show();
		$('#quick_login_area').hide();
		$.kajax({      
			ajx_rtn_type:'JSON',
			url:$('#'+formid).attr('action'),      
			type:'post',
			data:{ 	email:$('#'+formid).find("input@[name='login_email']").val()
					,password:$('#'+formid).find("input@[name='login_password']").val()
					,verify:$('#'+formid).find("input@[name='login_verify']").val()} ,    
			//async: false ,
			success: function(obj){ 
				if(obj.status==1){
					k_success('登陆成功！');
					setTimeout(function() { window.location.reload(); }, 1000);
				}else{
					$('#show_logining').hide();
					$('#quick_login_area').show();
				}
			}
		});
	}
}
</script>
<style>
.b_input {
    font-size: 18px;
    height: 28px;
    line-height: 28px;
    width: 200px;
}
.do_list {
    color: #000000;
    margin-top: 20px;
}
</style>
<!--快速登录-->
<div id='show_logining' style="display:none;width:450px;height:320px">
	<div class="clear"></div>
	<div style="width:100%;text-align:center;margin-top:15px;"><img src='/Public/Images/global/loading.gif'>&nbsp;&nbsp;数据加载中...</div>
</div>
<div id="quick_login_area" style="width:450px;">
<div class="tab-menu" id="quick_login_nav"><!-- 切换标签 begin  -->
  <ul>
    <li><a href="###" rel='login' class="on" 
    		onclick="k_changeGroupStyle('quick_login_nav',' ul > li > a ','login','on');
    				$('#login_area').show();$('#regist_area').hide();"><span>用户登录</span></a></li>
    
    <!--  
    <li><a href="###" rel='regist'
    		onclick="k_changeGroupStyle('quick_login_nav',' ul > li  > a ','regist','on');
    				$('#regist_area').show();$('#login_area').hide();"><span>注册</span></a></li>
    -->
    <li><a href="{:U('Index://Public/register')}" rel='regist'><span>用户注册</span></a></li>
    <li><a href="{:U('agent://Public/login')}" ><span>联盟登录</span></a></li>
    
    <li><a href="{:U('agent://Public/register')}" ><span>联盟注册</span></a></li>
    
  </ul>
</div>
<div class="reg_box" id="login_area">
  <div style="width: auto; height: auto;padding-bottom: 15px;" class="do_box">
		    <div class="clear"></div>
		    <form action="{:U('Index://Public/doLogin')}" method="post" id="loginForm">
		    <table cellspacing="0" cellpadding="0" border="0" align="center" class="do_list">
		      <tbody><tr>
		        <td height="50" width="90" align="right" valign="middle"><span class="reg_item">Email:</span></td>
		        <td width="205" valign="middle">
		        <div class="mailline">
		            <input type="text" class="do_input uemail b_input" value="" 
            					name="login_email" require="true" datatype="limit|email" min="1"
            					msg="不能为空|格式错误"/>
		        </div>
		        </td>
		        <td align="left" width="155" valign="middle">
		        	<div id="success_login_email"  style="display:none;"> <span class="ico_cue_ok"></span> </div>
		          <div class="error_login_email" style="position: relative;display:none;"> <span class="ico_cue_no"></span>
		          <span id="error_login_email"></span> </div>
		        </td>
		      </tr>
		      <tr>
		        <td height="50" align="right" valign="middle"><span class="reg_item">密码:</span></td>
		        <td valign="middle">
		        	<input type="password" class="do_input psd_input b_input" 
		        					name="login_password" id="login_password" require="true" value="" 
		        					datatype="limit"  min="6" max="16" msg="长度6-16"/>       
		        </td>
		        <td align="left" valign="middle">
		        	<div id="success_login_password"  style="display:none;"> <span class="ico_cue_ok"></span> </div>
		          <div class="error_login_password" style="position: relative;display:none;"> <span class="ico_cue_no"></span>
					<span id="error_login_password"></span> </div>
		        </td>
		      </tr>
		      <php> $verify_allow = unserialize($site_opts["verify"]);
            $login_verify_allow = $verify_allow['login']; </php>
          <eq name="register_verify_on" value="1">
		      <tr>
		        <td height="50" align="right" valign="middle"><span class="reg_item">验证码:</span></td>
		        <td valign="middle">
		       		<span class="yzm_box" style="width: 100px">
		       			<input type="text" class="do_input b_input" style="margin-right: 12px;width: 84px"
		        		name="login_verify" require="true" value="" datatype="require"  
		        		msg="输入验证码"/>
		       		</span>
		       		<img onclick="ql_changeverify()" id="login_verify"
		       		style="cursor: pointer;vertical-align: middle;" alt="看不清？请点击！" 
		       		src="{:U('Index://Public/verify')}">
		       		<a class="forget" href="javascript:void(0);" onclick="ql_changeverify()" 
		       			style="cursor: pointer;margin: 0 0px 0px 10px;">换一张</a>
		        </td>
		        <td align="left" valign="middle">
		        	<div id="success_login_verify"  style="display:none;"> <span class="ico_cue_ok"></span> </div>
		       		<div class="r error_login_verify" style="position: relative;display:none;"> 
		       		<span class="ico_cue_no"></span><span id="error_login_verify"></span> </div>
		        </td>
		      </tr>
		      </eq>
		      
		      <tr>
		        <td height="25" align="right" valign="middle">&nbsp;</td>
		        <td valign="middle"><input type="checkbox" id="remember" class="autologin" name="remember" value="1" checked="checked">
		        <b><label for="remember">下次自动登录</label></b></td>
		        <td align="left" valign="middle"><span></span></td>
		      </tr>
		      <tr>
		        <td height="60" align="right" valign="middle">&nbsp;</td>
		        <td valign="middle" style="padding-bottom: 15px;" colspan="2">
		        	<input type="button" onclick="doFormLoginSubmit('loginForm')" class="submit_btn reglogin_btn" value="登&nbsp;录" name="input2">
		          <a target="_blank" href="{:U('Index://Public/sendPassword')}" class="forget">忘记密码？</a><span></span></td>
		        </tr>
		        
		      <tr>
		        <td height="60" align="right" valign="middle">&nbsp;</td>
		        <td valign="middle" colspan="2">
		          <table cellspacing="0" cellpadding="0" border="0" width="300">
		          <tbody><tr>
		            <td height="30" colspan="2"><b>使用合作网站账号登录{$ts['site']['site_name']}：</b></td>
		            </tr>
		          <tr>
		            <td>
		            	<php>if($sinaurl) {</php>
		            	<a href="{$sinaurl}">
		            	<img src="/Public/Images/global/sina_login_logo.png"></a>
		            	<php>}</php>
		            </td>
		            <td>
		            	<php>if($doubanurl) {</php>
		            	<a href="{$doubanurl}">
		            	<img src="/Public/Images/global/doubao_login_logo.png"></a>
		            	<php>}</php>
		            </td>
		          </tr>
		        </tbody></table>
		          </td>
		        </tr>
		    </tbody></table>
		    <input type="hidden" value="act_login" name="act">
		    <input type="hidden" id="back_act" value="" name="back_act">
		    </form>
		</div>
		

		    <div id="clear"></div>
		 </div>


<div class="reg_box" id="regist_area" style="display:none;">
  <div style="width: auto; height: auto;padding-bottom: 15px;" class="do_box">
    <form action="{:U('Index://Public/doRegister')}" method="post" id="regform" name="reg">
    <table cellspacing="0" cellpadding="0" border="0" align="center" class="do_list">
      <tbody><tr>
        <td height="50" align="right" width="90" valign="middle"><span class="reg_item">Email:</span></td>
        <td width="205" valign="middle">
        <div class="mailline">
            <input type="text" class="do_input uemail b_input" value=""
            name="email" require="true" datatype="email|ajax" 
            url="{:U('Index://Public/isEmailAvailable')}" msg="格式错误|邮箱已注册"/>
        </div>
        </td>
        <td align="left" width="155" valign="middle">
        	<div id="success_email" style="display:none;"> <span class="ico_cue_ok"></span> </div>
          <div class="error_email" style="position: relative;display:none;"> <span class="ico_cue_no"></span><span id="error_email"></span> </div>
	
        </td>
      </tr>
      <tr>
        <td height="50" align="right" valign="middle"><span class="reg_item">昵称:</span></td>
        <td valign="middle">
        	<input type="text" class="do_input uemail b_input" value="" 
        		name="uname" id="uname" require="true" datatype="ajax" max="12"
        		url="{:U('Index://Public/isValidNickName')}" msg="输入昵称|昵称已占用"/>
        </td>
        <td align="left" valign="middle">
        	<div id="success_uname" style="display:none;"> <span class="ico_cue_ok"></span> </div>
          <div class="error_uname" style="position: relative;display:none;"> 
          	<span class="ico_cue_no"></span><span id="error_uname"></span> </div>
				</td>
      </tr>
      <tr>
        <td height="50" align="right" valign="middle"><span class="reg_item">密码:</span></td>
        <td valign="middle">
        	<input type="password" class="do_input psd_input b_input" 
        					name="password" id="password" require="true" value="" 
        					datatype="limit"  min="6" max="16" msg="6-16个字符"/>       
        </td>
        <td align="left" valign="middle">
        	<div id="success_password"  style="display:none;"> <span class="ico_cue_ok"></span> </div>
          <div class="error_password" style="position: relative;display:none;"> <span class="ico_cue_no"></span> <span id="error_password"></span> </div>
        </td>
      </tr>
      <tr>
        <td height="50" align="right" valign="middle"><span class="reg_item">确认密码:</span></td>
        <td valign="middle">
        	<input type="password" class="do_input psd_input b_input" 
        					name="repassword" require="true" value="" datatype="repeat|limit"  
        					min="6" max="16" to="password" msg="确认密码错误|请再输入一次"/>  
        </td>
        <td align="left" valign="middle">
        	<div id="success_repassword"  style="display:none;"> <span class="ico_cue_ok"></span> </div>
					<div class="r error_repassword" style="position: relative;display:none;"> <span class="ico_cue_no"></span> <span id="error_repassword"></span> </div>
        </td>
      </tr>
            <tr>
        <td height="50" align="right" valign="middle"><span class="reg_item">验证码:</span></td>
        <td valign="middle">
       		<span class="yzm_box" style="width: 100px;">
       			<input type="text" class="do_input b_input" style="margin-right: 12px;width: 84px;"
        		name="verify" require="true" value="" datatype="require"  
        		msg="输入验证码|验证码错误"/>
       		</span>
       		<img onclick="ql_changeverify()" id="regist_verify"
       		style="cursor: pointer;vertical-align: middle;" alt="看不清？请点击！" 
       		src="{:U('Index://Public/verify')}">
       		<a class="forget" href="javascript:void(0);" onclick="ql_changeverify()" 
       			style="cursor: pointer;margin: 0 0px 0px 10px;">换一张</a>
        </td>
        <td align="left" valign="middle">
        	<div id="success_verify"  style="display:none;"> <span class="ico_cue_ok"></span> </div>
       		<div class="r error_verify" style="position: relative;display:none;"> <span class="ico_cue_no"></span> <span id="error_verify"></span> </div>
        </td>
      </tr>
            <tr>
        <td height="25" align="right" valign="middle">&nbsp;</td>
        <td valign="middle" colspan="2"><input type="checkbox" checked="checked" class="autologin" value="1" id="agreement_input" name="agreement">
           <b><label for="agreement_input">已阅读并接受</label></b><a href="" style="margin-left: 0pt;" tabindex="-1" class="forget">《{$ts['site']['site_name']}用户协议》</a></td>
        <td align="left" valign="middle"><span></span></td>
      </tr>
      <tr>
        <td height="56" align="right" valign="middle">&nbsp;</td>
        <td valign="middle" colspan="2">
        	<input type="submit"  class="reglogin_btn" value="注&nbsp;册" name="input2"></td>
      </tr>
    </tbody></table>
    
    </form>
  </div>
</div>

</div>
